home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / update~4.z / update~4 / lib_new_tmpnam.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  915 b   |  40 lines

  1. /* author:    Monty Walls
  2.  * written:    4/17/89
  3.  * Copyright:    Copyright (c) 1989 by Monty Walls.
  4.  *        Not derived from licensed software.
  5.  *
  6.  *        Permission to copy and/or distribute granted under the
  7.  *        following conditions:
  8.  *    
  9.  *        1). This notice must remain intact.
  10.  *        2). The author is not responsible for the consequences of use
  11.  *            this software, no matter how awful, even if they
  12.  *            arise from defects in it.
  13.  *        3). Altered version must not be represented as being the 
  14.  *            original software.
  15.  */
  16. #include <stdio.h>
  17.  
  18. #ifndef P_tmpdir
  19. #define P_tmpdir    "/tmp"
  20. #define L_tmpnam    14
  21. #endif
  22.  
  23. #ifndef __STDC__
  24. extern char *mktemp(/* char * */);
  25. extern char *strcpy();
  26. extern char *strcat();
  27. #endif
  28.  
  29. char * tmpnam(buf)
  30. char *buf;
  31. {
  32.     static char our_buf[2*L_tmpnam];
  33.     register char *dest;
  34.  
  35.     dest = (buf == (char *)NULL ? our_buf: buf);
  36.     strcpy(dest, P_tmpdir);
  37.     strcat(dest, "/tmp.XXXXXX");
  38.     return(mktemp(dest));
  39. }
  40.